package com.ylr.retrofitLearning.Controller;

import com.ylr.retrofitLearning.Api.TestSignApi;
import com.ylr.retrofitLearning.Service.TestServiceImpl;
import com.ylr.自定义枚举类校验.User;
import com.ylr.自定义枚举类校验.UserDto;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @ClassName HelloController
 * @Description TODO
 * @Author ylr
 * @Date 2021/7/22 15:16
 * @Version 1.0
 */

@RestController
@RequestMapping("api")
public class HelloMyController {

    @Resource
    private TestServiceImpl testService;
    @Resource
    private TestSignApi testSignApi;

    @GetMapping("get")
    public String hello(){
        return testService.test();
    }

    @GetMapping("get1")
    public String hello1(){
        return testService.test1();
    }

    @GetMapping("helloSign/{id}")
    public String helloSign(@PathVariable String id){
        return testSignApi.getText(id);
    }

    @GetMapping("helloSign1")
    public String helloSign1(){
        return testSignApi.getText1();
    }

    @GetMapping("hello/enum")
    public String helloEnum(@Valid  @RequestBody UserDto user){

        return user.toString();
    }

    @GetMapping("hello/enum1")
    public String helloEnum(@Valid  @RequestBody User user){

        return user.toString();
    }
}
